package cn.edu.scnu.springbootcinema.config;

import cn.edu.scnu.springbootcinema.interceptor.FilterInterceptor;
import cn.edu.scnu.springbootcinema.interceptor.LoginInterceptor;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;

@Configuration
public class WebMvcConfigurer implements org.springframework.web.servlet.config.annotation.WebMvcConfigurer {
    @Resource
    private LoginInterceptor loginInterceptor;

    @Resource
    private FilterInterceptor filterInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor).addPathPatterns("/**");
        registry.addInterceptor(filterInterceptor).addPathPatterns("/**")
                .excludePathPatterns("/user/**")
                .excludePathPatterns("/error")
                .excludePathPatterns("/js/**")
                .excludePathPatterns("/css/**")
                .excludePathPatterns("/favicon.ico")
                .excludePathPatterns("/**");


    }
}
